import * as vscode from 'vscode';
export class InputBox {
  private inner: vscode.InputBox;

  get value() { return this.inner.value; }
  set value(v) { this.inner.value = v; }
  get placeholder() { return this.inner.placeholder; }
  set placeholder(v) { this.inner.placeholder = v; }
  get step() { return this.inner.step; }
  set step(v) { this.inner.step = v; }
  get totalSteps() { return this.inner.totalSteps; }
  set totalSteps(v) { this.inner.totalSteps = v; }
  get title() { return this.inner.title; }
  set title(v) { this.inner.title = v; }
  get ignoreFocusOut() { return this.inner.ignoreFocusOut; }
  set ignoreFocusOut(v) { this.inner.ignoreFocusOut = v; }

  constructor() {
    this.inner = vscode.window.createInputBox();
  }

  show(): Promise<InputBox> {
    const ret = new Promise<InputBox>((resolve, reject) => {
      this.inner.onDidAccept(() => resolve(this));
      this.inner.onDidHide(() => reject());
    });
    this.inner.show();
    return ret;
  }

  hide() {
    return this.inner.hide();
  }

  static create(): InputBox {
    return new InputBox();
  }
}
